// function useState(state: any) {
//     let currentState = state

//     const changeState = (newState: any) => {
//         currentState = newState
//     }
//     const tuple: [any, (newState: any)=> void] = [currentState, changeState]
//     return tuple
// }

// const [curreter, setCounter] = useState(10)

// <T> 泛型，可以传递数据类型
// tuple 可以根据数组设置特定的数据类型
type MyFunction = () => void
const foo: MyFunction = () => {}
function useState<T>(state: T):  [T, (newState: T)=> void]  {
    let currentState = state
    const changeState = (newState: T) => {
        currentState = newState
    }

    return [currentState, changeState]
}

const [curreter, setCounter] = useState('abc')
export {}